		TITLE	SECTMAP - Copyright (C) SLR Systems 1993

		INCLUDE	MACROS

if	any_overlays

		.DATA



		.CODE	PASS2_TEXT



		ASSUME	DS:NOTHING

ALLOW_SECTION_MAP	PROC
		;
		;
		;
if	any_overlays
if	fg_os2
		RELEASE	SECTIONMAP_OK_SEM
else
		CALL	DO_PRINT_SECTIONS
endif
endif
		RET

ALLOW_SECTION_MAP	ENDP


		ASSUME	DS:NOTHING

DO_PRINT_SECTIONS	PROC
		;
		;OUTPUT A DETAILED LIST DESCRIBING ALL SECTIONS IN FILE (IF OVERLAYS)
		;
		BITT	SEGMENTS_MAP
		JZ	9$
		BITT	DOING_OVERLAYS
		JZ	9$
if	fg_os2
		CAPTURE	SECTIONMAP_OK_SEM
endif
		LEA	SI,SECTIONS_HEADER
		CALL	HEADER_OUT

		LDS	SI,FIRST_SECTION
		FIXES
		JMP	8$

1$:
		MOV	WM_CURN_SECTION.OFFS,SI
		MOV	WM_CURN_SECTION.SEGM,DS
		SYM_CONV_DS
		PUSHM	[SI]._SECT_NEXT_SECTION_ORDER.OFFS,[SI]._SECT_NEXT_SECTION_ORDER.SEGM
		CMP	[SI]._SECT_NUMBER,0
		JZ	5$				;SKIP ROOT
		TEST	[SI]._SECT_FLAGS,MASK SECT_CODEVIEW
		JNZ	5$				;SKIP CODEVIEW
		CALL	PRINT_SECTION
5$:
		POPM	DS,SI
8$:
		MOV	CX,DS
		OR	CX,CX
		JNZ	1$
9$:
		RET

DO_PRINT_SECTIONS	ENDP

		ASSUME	DS:NOTHING

PRINT_SECTION	PROC	NEAR
		;
		;FIRST, SECTION #
		;
		LEA	DI,XOUTBUF
		MOV	AL,' '
		STOSB
		MOV	AX,[SI]._SECT_NUMBER
		XOR	DX,DX
		CALL	HEXDWOUTSH
		LEA	CX,XOUTBUF+7
		CALL	SPACE_OUT
		;
		;NOW PRINT OUTPUT FILENAME
		;
		LDS	SI,[SI]._SECT_OUTFILE
		SYM_CONV_DS
		LDS	SI,[SI]._OF_FILE_LIST
		LEA	SI,[SI].FILE_LIST_NFN
		CALL	CONV_MOVE_PRIM_EXT
		LEA	CX,XOUTBUF+20
		CALL	SPACE_OUT
		;
		;NOW PRINT FILE ADDRESS
		;
		LDS	SI,WM_CURN_SECTION
		SYM_CONV_DS
		MOV	AX,[SI]._SECT_FILE_ADDRESS.LW
		MOV	DX,[SI]._SECT_FILE_ADDRESS.HW
		CALL	SHR_DXAX_4		;CONVERT TO PARAGRAPH
		CALL	OUT5			;PRINT IT
		;
		;NOW PRINT FILE SIZE
		;
		MOV	AX,[SI]._SECT_FILE_SIZE
		XOR	DX,DX
		CALL	OUT5
		;
		;NOW OUTPUT MEMORY LOAD ADDRESS
		;
		MOV	AX,[SI]._SECT_BASE_ADDRESS.LW
		MOV	DX,[SI]._SECT_BASE_ADDRESS.HW
		CALL	SHR_DXAX_4
		CALL	OUT5
		;
		;NOW OUTPUT MEMORY SIZE
		;
		MOV	AX,[SI]._SECT_MAX_ADDRESS.LW
		MOV	DX,[SI]._SECT_MAX_ADDRESS.HW
		ADD	AX,15
		ADC	DX,0
		SUB	AX,[SI]._SECT_BASE_ADDRESS.LW
		SBB	DX,[SI]._SECT_BASE_ADDRESS.HW
		CALL	SHR_DXAX_4
		CALL	OUT5

if	fg_plink



endif

		CALL	LINE_OUT
		RET

PRINT_SECTION	ENDP


iff	data_in_codeseg

		.DATA

endif

if	fg_plink

SECTIONS_HEADER DB	LENGTH SECTIONS_HEADER-1,0DH,0AH,\
' Sect# Fname        Faddr  Fsize  Maddr  Msize  Parent   Name',0dh,0ah
else

SECTIONS_HEADER DB	LENGTH SECTIONS_HEADER-1,0DH,0AH,\
' Sect# Fname        Faddr  Fsize  Maddr  Msize',0dh,0ah
endif

endif

		END

